﻿@model Lead2012.ViewModels.CalendarItemViewModel

@{
    ViewBag.Title = "Quản lý lịch sử sự kiện";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<form class="form" action="##">
<div id="apps" class="content">
	<h2 class="app">        
		<span class="viewtitle"><strong>Quản lý lịch sử sự kiện</strong> <a href="javascript:void(0)" class="info" title="Danh sách lịch hẹn khách hàng theo thời gian"><em>info</em></a></span>
	</h2>  
    <div class="toolbar topblue">
        <span class="area">
            <span class="spl" style=""><strong>Lọc dữ liệu:</strong></span>
            <div class="select-holder lead-sources spl returnleads">
                <select id="OwnerId" class="editable-select" data-bind='value: OwnerId, foreach: UserOptions'>
                    <option data-bind="value: ID, text: ItemName"></option>
                </select>
            </div>
        </span>
        <span class="area">
            <label for="txt-from" class="spl" style="font-weight:normal;">Từ:</label>
            <input type="text" id="startDate" value='@Model.FromDate.ToString("dd/MM/yyyy")'  class="text date spl" />
            <label for="txt-from" class="spl" style="font-weight:normal;padding-left:5px;">Đến:</label>
            <input type="text" id="endDate" value='@Model.ToDate.ToString("dd/MM/yyyy")' class="text date"/>
        </span>

        <span class="area left"><a class="btn btn-go" href="javascript:void(0);" data-bind="click: SearchButton">Go</a></span>
    </div>

    <span class="paging" data-bind="visible: ItemList().length>0">
        <span class="pageleft">
            <span class="total" data-bind='text: PageText'></span>
            <span class="show">Hiển thị <input type="text" class="text" id="PageSize" data-bind="value: PageSize" onkeypress="return isNumberKey(event)" /> trên trang <span class="smallText" data-bind="text: PageSizeText"></span></span>
        </span>
        <span class="pages">
            <span class="smallText" data-bind="text: PageIndexText, visible: ItemList().length>0"></span> 
            Trang <input type="text" class="text" id="PageIndex" data-bind="value: PageIndex" onkeypress="return isNumberKey(event)" /> của <span data-bind="text: TotalPage"></span>
            <a href="javascript:void(0)" class="btn btn-prev-arrow" data-bind="click: PrevButton, attr: {'class': PrevButtonClass}"></a>                            
            <a href="javascript:void(0)" class="btn btn-next-arrow" data-bind="click: NextButton, attr: {'class': NextButtonClass}"></a>
        </span>
    </span>
    <div class="panel" data-bind="visible: ItemList().length>0">        
        <table class="tablegrid" cellspacing="0" border="0">
            <thead>
                <tr class="title">        
		            <th>
                        <span class="w">Tên khách hàng</span>
                    </th>      
		            <th>
                        <span class="w">Tiêu đề</span>
                    </th>
		            <th>
                        <span class="w">Ngày hẹn</span>
                    </th>
                    <th>
                        <span class="w">Giờ hẹn</span>
                    </th>
                    <th>
                        <span class="w">Thời gian</span>
                    </th>
		            <th class="last centeralign"><span class="w">Xóa</span></th>
                </tr>
            </thead>
            <tbody data-bind="foreach: ItemList">
                <tr class="line">
		            <td>
                        <span class="w">
                            <a data-bind='text: LeadName, attr:{href: "/Lead/Edit/" + LeadId}'></a>
                        </span>
                    </td>
		            <td>
                        <span class="w" data-bind='text: Title'></span>
                    </td>
		            <td><span class="w" data-bind="text: EventDate"></span></td>
                    <td><span class="w" data-bind="text: EventTime"></span></td>
                    <td>
                        <span class="w" data-bind='text: DurationMins + " phút"'></span>
                    </td>
		            <td class="last centeralign">
                        <span class="w">
                            <a class="btn btn-x delete" href="javascript:void(0)" data-bind='click:$parent.DeleteItems'>Delete</a>
                        </span>
                    </td>
	            </tr>
            </tbody>
        </table>
        @Html.Partial("PopupDelete")
    </div>
    <div class="panel" data-bind="visible: ItemList().length<=0" style="display:none">
        <span class="error-msg">Không kết quả nào được tìm thấy.</span>
    </div>
</div>
</form>
<script type="text/javascript">
    var data = @(Html.Raw(Json.Encode(Model)));
</script>
<script src="/Scripts/CalendarItem/CalendarItemGrid.js" type="text/javascript"></script>